﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ScheduleMaker.DB.Domain.Core;

namespace ScheduleMaker.DB.Domain
{
    public class TeacherUniversity : UserUniversity, Teacher
    {
        private string name;
        private IList<Hour> hours;
        private IDictionary<Subject, Int32> subjectCount;
        private IList<Schedule> schedule;

        public virtual string Name
        {
            get { return name; }
            set { name = value; }
        }

        public virtual IList<Subject> Subjects
        {
            get { return (new List<Subject>(subjectCount.Keys)); }
            set { throw new UnsupportedPropertyException(); }
        }

        public virtual IDictionary<Subject, Int32> SubjectCount
        {
            get { return subjectCount; }
            set { subjectCount = value; }
        }

        public virtual IList<Hour> Hours
        {
            get { return hours; }
            set { hours = value; }
        }

        IList<Schedule> Schedule
        {
            get { return schedule; }
            set { schedule = value; }
        }

        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            var t = obj as TeacherUniversity;
            if (t == null)
                return false;
            if (Id == t.Id
                && Name == t.Name
                && Login == t.Login
                && Firstname == t.Firstname
                && Surname == t.Surname)
                return true;
            return false;
        }

        public override int GetHashCode()
        {
            return (Id + "|"
                + Name + "|"
                + Login + "|"
                + Firstname + "|"
                + Surname).GetHashCode();
        }
    }
}
